package integral

import (
	"net/http"

	"private-domain-overseas-service/admin/business/api/internal/logic/integral"
	"private-domain-overseas-service/admin/business/api/internal/svc"
	"private-domain-overseas-service/admin/business/api/internal/types"

	"github.com/zeromicro/go-zero/rest/httpx"
	"private-domain-overseas-service/pkg/result"
)

// 积分商城商品列表
func IntegralGoodsListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.IntegralGoodsListRequest
		if err := httpx.Parse(r, &req); err != nil {
			result.HttpErrorResult(r, w, err)
			return
		}

		l := integral.NewIntegralGoodsListLogic(r.Context(), svcCtx)
		resp, err := l.IntegralGoodsList(&req)

		result.HttpResult(r, w, resp, err)
	}
}
